import { useEffect } from 'react';
import BiliDetail from './biliDetail';
const pageTitle = document.title;

/**
 * 首页
 * 判断页面加载某个组件
 */
export default function IndexPage() {
  useEffect(() => {
    //避免浏览器title不展示
    setTimeout(() => {
      document.title = pageTitle;
    }, 500);
    console.log('进入插件');
  }, []);
  if (
    ['www.bilibili.com', 'm.bilibili.com'].includes(location.host) &&
    window.__INITIAL_STATE__
  ) {
    //B站详情页
    return <BiliDetail />;
  }
  return null;
}
